package test;

import java.util.List;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;

import projectsupporter.common.formbase.progrees.LongRunningOperation;
import projectsupporter.common.formbase.progrees.ProgressBarDialog;

public class ProgressBarExample2 {
	
	protected List<String> list;
	
	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setLayout(new GridLayout());
		shell.open();
		
		
		
		ProgressBarDialog bar=new ProgressBarDialog(shell);
		bar.setMax(30);
		bar.setMin(0);
		//添加线程，在线程中处理长时间的任务，并最终反映在平滑进度条上
//		new LongRunningOperation(bar)
//		{
//			
//			public void run() {
//				
//				for (int i = 0; i < 30; i++) {
//				try {
//					Thread.sleep(1000);
//					} catch (InterruptedException e) {
//
//					}
//					
//					move();
//				}
//			}
//		}.start();
		bar.open();
		
		
		while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) {
		display.sleep();
		}
		}
		}
		}
